package com.chj.design.sk;

public class Code11_Decorator2 {
	public interface Car {

		void drive();
	}

	public static class BMW implements Car {
		@Override
		public void drive() {
			System.out.println("宝马汽车，风驰电掣。");
		}
	}

	public static abstract class WeddingCarDecorator implements Car {

		private Car decoratorCar;

		public WeddingCarDecorator(Car decoratorCar) {
			this.decoratorCar = decoratorCar;
		}

		@Override
		public void drive() {
			decoratorCar.drive();
		}
	}

	public static class BMWWeddingCar extends WeddingCarDecorator {

		public BMWWeddingCar(Car decoratorCar) {
			super(decoratorCar);
		}

		@Override
		public void drive() {
			beautify();
			super.drive();
		}

		private void beautify() {
			System.out.println("结婚婚车，铺上鲜花，系上气球。");
		}
	}

	public static void main(String[] args) {

		System.out.println("------正常的德系宝马------");
		BMW bmw = new BMW();
		bmw.drive();
		System.out.println("------作为婚车的德系宝马------");
		BMWWeddingCar bmwWeddingCar = new BMWWeddingCar(bmw);
		bmwWeddingCar.drive();
	}
}
